__author__ = 'East'

import time

def timer(func):      # timer(test1) function=test1
    def deco(*args, **kwargs):
        start_time = time.time()
        func(*args, **kwargs)
        stop_time = time.time()
        print('the function run time is %s' % (stop_time - start_time))
    return deco

@timer      # test1 = timer(test1)
def test1():
    time.sleep(3)
    print('in the test1')

@timer
def test2(name):
    time.sleep(3)
    print('in the test2', name)

# test1 = deco(test1)
# test2 = deco(test2)
#
# test1()
# test2()

# test1 = timer(test1)

test1()
test2('alex')